package com.wang.wx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wang.wx.common.Result;
import com.wang.wx.mapper.TwitterUserMapper;
import com.wang.wx.entity.TwitterUser;
import com.wang.wx.service.TwitterUserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.sql.DataSource;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

/**
 * (TwitterUser)表服务实现类
 *
 * @author makejava
 * @since 2024-08-03 18:54:47
 */
@Slf4j
@Service
public class TwitterUserServiceImpl extends ServiceImpl<TwitterUserMapper, TwitterUser> implements TwitterUserService {
    
    
    @Override
    public List<TwitterUser> getByEmail(String email) {
        LambdaQueryWrapper<TwitterUser> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(TwitterUser::getEmail, email);
        wrapper.select(TwitterUser::getEmail,TwitterUser::getScreenName);
        return this.list(wrapper);
    }

    @Override
    public void createIndexes() {
        log.info("推特索引创建中");
        baseMapper.createIndexes();
        log.info("推特索引创建成功");
    }

    public void dropIndexes() {
        baseMapper.dropIndexes();
        log.info("推特索引删除成功");
    }
}

